package PROYECTO2.src.Naves.Enemigos;
import java.net.URL;
import javax.swing.ImageIcon;

import PROYECTO2.src.Explosiones_Disparos.Shot;
import PROYECTO2.src.Naves.Spaceship;

public class Raider extends Cylon {

	protected static final URL url = (Spaceship.class.getClassLoader().getResource("PROYECTO2/src/img/Enemigo/Raider.gif"));
	protected static final URL urlUp = (Spaceship.class.getClassLoader().getResource("PROYECTO2/src/img/Enemigo/RaiderUP.gif"));
	private static final int defaultWidth = 60;
	private static final int defaultHeight = 48;
	private static final int defaultSpeed = 5;
	private static final int defaultLife = 5;
	private boolean up;
	private boolean firstMovement = true;
	
	public Raider(boolean up){
		super(defaultLife,defaultSpeed,up? new ImageIcon(urlUp): new ImageIcon(url),defaultWidth,defaultHeight);
		y = -defaultHeight;
		this.up = up;
		score = 50;
	}

	@Override
	public boolean isEspecial() {
		return up;
	}

	@Override
	public void shooting() {
		if(cantShot() && y<500){
			Shot d = pointAndShoot();
			game.addShotCylon(d);
		}
	}

	@Override
	public void move() {
		if(firstMovement){
			x = colonial.getX();
			firstMovement = false;
		}
		
		y += speed;
		collisionCheck();
		setRotacion();
	}
}